[LINUX] PV-on-HVM: Implement HDIO_GETGEO ioctl on kernels before
authorIan Campbell <ian.campbell@xensource.com>
Wed, 25 Oct 2006 12:58:30 +0000 (13:58 +0100)
committerIan Campbell <ian.campbell@xensource.com>
Wed, 25 Oct 2006 12:58:30 +0000 (13:58 +0100)
2.6.16.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
Signed-off-by: K. Y. Srinivasan <ksrinivasan@novell.com>
Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@jp.fujitsu.com>
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c

index e79b653a973fc9ec2a0a2e8ae4f7e8f4b65bbdf7..b5293ce568459b61a9d3c3d57b30a48d886912be 100644 (file)
@@ -468,6 +468,27 @@ int blkif_ioctl(struct inode *inode, struct file *filep,
                      command, (long)argument, inode->i_rdev);
 
        switch (command) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
+       case HDIO_GETGEO: {
+               struct block_device *bd = inode->i_bdev;
+               struct hd_geometry geo;
+               int ret;
+
+                if (!argument)
+                        return -EINVAL;
+
+               geo.start = get_start_sect(bd);
+               ret = blkif_getgeo(bd, &geo);
+               if (ret)
+                       return ret;
+
+               if (copy_to_user((struct hd_geometry __user *)argument, &geo,
+                                sizeof(geo)))
+                        return -EFAULT;
+
+                return 0;
+       }
+#endif
        case CDROMMULTISESSION:
                DPRINTK("FIXME: support multisession CDs later\n");
                for (i = 0; i < sizeof(struct cdrom_multisession); i++)
index 8aa453d3a0aca25527d67e4134a428c3a55d9990..4155ad6a2d91420201389cac15d686afbae9d1cd 100644 (file)
@@ -91,7 +91,9 @@ static struct block_device_operations xlvbd_block_fops =
        .open = blkif_open,
        .release = blkif_release,
        .ioctl  = blkif_ioctl,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
        .getgeo = blkif_getgeo
+#endif
 };
 
 DEFINE_SPINLOCK(blkif_io_lock);